package com.ymttest.database.sqlwapper;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.ymt.core.tool.FormatUtil;
import com.ymt.database.SqlManager;
import com.ymttest.database.model.IpChunHui;
import com.ymttest.utils.TestDataManager;
import com.ymttest.utils.YMTDateUtil;

public class IPWapper {
	SqlManager manage;

	public IPWapper() {
		manage = new SqlManager("ipwarehouse");
	}

	public List<IpChunHui> selectIpInfo(Long ip){
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("ip", ip);
		List<IpChunHui> IpChunHui = manage.getSelectResults(
				"com.ymttest.database.mapping.IpChunHuiMapper.selectIpInfo", params);
		return IpChunHui;
	}
	
	/**
	 * 关闭数据库连接
	 */
	public void close() {
		manage.close();
	}

	@Override
	protected void finalize() throws Throwable {
		this.close();
		manage = null;
		super.finalize();
	}

	
	public static void main(String[] args) {
		System.out.println(FormatUtil.beanToGSONString(new IPWapper().selectIpInfo(TestDataManager.converIpToLong("172.16.101.11")).get(0)));
	}
}
